//
//  XMJobListViewController.m
//  XMJJ_zml
//
//  Created by 丁浩 on 2025/5/22.
//

#import "XMJobListViewController.h"
#import "XMJobListView.h"
#import "XMNetwork+mine.h"

@interface XMJobListViewController ()

@property (nonatomic, strong) XMJobListView *jobListView;

@end

@implementation XMJobListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creatUI];
}

- (void)creatUI {
    [self.view addSubview:self.jobListView];
    [self getJobList];
}

- (void)getJobList {
    XMWeakSelf;
    [_Network getJobListSuccess:^(id  _Nonnull responseObject) {
        [weakSelf.jobListView setContentWithJobList:[responseObject objectForKey:@"data"]];
    } failure:^(NSError * _Nonnull error) {
        
    }];
}

- (XMJobListView *)jobListView {
    if (!_jobListView) {
        _jobListView = [[XMJobListView alloc] initWithFrame:self.view.bounds];
        XMWeakSelf;
        _jobListView.jobSelectBlock = ^(NSString * _Nonnull jobStr) {
            weakSelf.jobSelectBlock ? weakSelf.jobSelectBlock(jobStr) : nil;
            [weakSelf.navigationController popViewControllerAnimated:YES];
        };
    }
    return _jobListView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
